Get instance id for desired control-queue(s)#1069
Get instance id for desired control-queue(s)#1069pasaini-microsoft wants to merge 11 commits intoAzure:mainfrom
Conversation
src/DurableTask.AzureStorage/AzureStorageOrchestrationServiceSettings.cs
Outdated
Show resolved
Hide resolved
…ettings.cs Co-authored-by: David Justo <david.justo.1996@gmail.com>
| controlQueueNumberToNameMap = new Dictionary<string, int>(); | ||
|
|
||
| for (int i = 0; i < partitionCount; i++) | ||
| { | ||
| var controlQueueName = AzureStorageOrchestrationService.GetControlQueueName(settings.TaskHubName, i); | ||
| controlQueueNumberToNameMap[controlQueueName] = i; | ||
| } | ||
| } |
There was a problem hiding this comment.
are we still using this in the new tests? No, right?
davidmrdavid
left a comment
There was a problem hiding this comment.
Have we tested this for external events as well?
…https://github.com/pasaini-microsoft/durabletask into users/pasaini/main/InstanceIdForSelectedControlQueue
| /// <summary> | ||
| /// Whether to allow instanceIDs to use special syntax to land on a specific partition. | ||
| /// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | ||
| /// </summary> | ||
| public bool EnableExplicitPartitionPlacement { get; set; } = false; |
There was a problem hiding this comment.
Something to consider - it is not safe to change this from false to true (or vice-versa) while an orchestrator with the special syntax is in-flight. If we do that, any pre-existing messages for that orchestrator may now be considered to be "in the wrong queue".
Let's call this out in the intellisense
|
|
||
| int placementSeparatorPosition = instanceId.LastIndexOf('!'); | ||
|
|
||
| // if the instance id ends with !nnn, where nnn is an unsigned number, it indicates explicit partition placement |
There was a problem hiding this comment.
can we add a test that documents the behavior if the customer uses an instanceID with multiple ! in there? Say instanceID "A!1!B!3` should probably map to partition "3", right?
There was a problem hiding this comment.
Let's also add a test that checks that instanceID myinstanceID!NotANumber does not trigger any errors / that it correctly ignores the explicit placement logic.
There was a problem hiding this comment.
Thank you for adding the first test, I think we're just missing the very last one:
Let's also add a test that checks that instanceID myinstanceID!NotANumber does not trigger any errors / that it correctly ignores the explicit placement logic.
davidmrdavid
left a comment
There was a problem hiding this comment.
This looks almost ready to me, but please note there's some outstanding suggestions (and a missing test request from my last review).
FYI @gillum, whose approval we should seek before merging this.
|
|
||
| int placementSeparatorPosition = instanceId.LastIndexOf('!'); | ||
|
|
||
| // if the instance id ends with !nnn, where nnn is an unsigned number, it indicates explicit partition placement |
There was a problem hiding this comment.
Thank you for adding the first test, I think we're just missing the very last one:
Let's also add a test that checks that instanceID myinstanceID!NotANumber does not trigger any errors / that it correctly ignores the explicit placement logic.
| /// <summary> | ||
| /// Whether to allow instanceIDs to use special syntax to land on a specific partition. | ||
| /// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | ||
| /// ** DO NOT CHANGE THIS FLAG FOR PRE-EXISTING MESSAGES AS IT MAY BE CONSIDERED IN THE WRONG QUEUE ** | ||
| /// </summary> |
There was a problem hiding this comment.
nit - I believe remark is the right docs tag for this sort of thing. Let's also not use all-caps for comments, I realize it has a useful effect, but it's not in our usual style for customer-facing docs.
| /// <summary> | |
| /// Whether to allow instanceIDs to use special syntax to land on a specific partition. | |
| /// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | |
| /// ** DO NOT CHANGE THIS FLAG FOR PRE-EXISTING MESSAGES AS IT MAY BE CONSIDERED IN THE WRONG QUEUE ** | |
| /// </summary> | |
| /// <summary> | |
| /// Whether to allow instanceIDs to use special syntax to land on a specific partition. | |
| /// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | |
| /// ** DO NOT CHANGE THIS FLAG FOR PRE-EXISTING MESSAGES AS IT MAY BE CONSIDERED IN THE WRONG QUEUE ** | |
| /// </summary> | |
| /// <remarks> | |
| /// It is not generally safe to change to this flag for pre-existing TaskHubs, as it may change the expected target queue for an instanceID. | |
| /// </remarks> |
davidmrdavid
left a comment
There was a problem hiding this comment.
FYI - I'll take the liberty of deleting the deleting the comment about adding a test at the beginning of TaskHubClient, since this is public documentation so it does not belong there. After that, I'll leave a 'LGTM'
| } | ||
|
|
||
| /// <summary> | ||
| /// Add test for this. |
There was a problem hiding this comment.
| /// Add test for this. |
Motivation
#1079
Issue: No way of targeting an orchestrator instance to a desired control-queue.
Motivation:
Issue: No way to load lightly loaded control-queues.
Motivation:
Proposal
API to generate instance id for a set of control-queues.